/**
 * 卸载注入的全局loading
 */
export const unmountGlobalLoading = () => {
  // 获取loading元素
  const loadingEle: HTMLDivElement | null = document.querySelector("#__app-loading__");
  if (loadingEle) {
    loadingEle.classList.add("hidden");
    const injectEle = document.querySelectorAll('[data-app-loading^="inject"]');
    // 在css完成过渡之后触发
    loadingEle.addEventListener(
      "transitionend",
      () => {
        loadingEle.remove();
        injectEle.forEach((ele) => ele.remove());
      },
      { once: true }
    );
  }
};
